import React from "react";
import {Carousel} from 'antd-mobile'
import s from './index.scss'
import icon5 from 'assets/images/icon5.png'
import {Flex,Icon} from 'antd-mobile'
import Link from "components/Link";

let linkTo=(url)=>{
    location.href = url
}
export default ({ carouselList,flag,right,title,leftImgUrl,notice}) =>{
    let centerStr = null
    let rightStr = null
    if(flag==1){
        centerStr = <Flex.Item style={{flex:8}}><Carousel className={`${s.myCarousel}`}
        vertical
        dots={false}
        dragging={false}
        swiping={false}
        autoplay
        infinite
      >
      
        <div className={`${s.item}`} onClick={linkTo.bind(this,notice.url)}><Link href={notice.url} >{notice.title}</Link></div>
        <div className={`${s.item}`} onClick={linkTo.bind(this,notice.url)}><Link href={notice.url} >{notice.title}</Link></div>
      
      </Carousel></Flex.Item>
    }else{
        centerStr = <Flex.Item style={{flex:8}}>{title}</Flex.Item>
    }
    if(right!=null&&right!=false&&right!=''){
        rightStr = <Flex.Item style={{flex:1}} className={`${s.right}`}><Link href="/announcementList" style={{display:'flex'}}><Icon type="ellipsis" /></Link></Flex.Item>
    }else{
        rightStr = null
    }
    return <Flex className={`${s.myCarouselBox}`}>
    <Flex.Item className={`${s.left}`} style={{flex:1}}>{leftImgUrl}</Flex.Item>
    {centerStr}
    {rightStr}
</Flex>
}

  